<nz-collapseset>
  <nz-collapse [nzTitle]="panels.name" [nzActive]="panels.active" [nzDisabled]="panels.disabled">
    <form nz-form [nzLayout]="'inline'">
      <div nz-row>
        <div nz-form-item nz-col [nzSpan]="8">
          <div nz-form-label nz-col [nzSm]="12" [nzXs]="6">
            <label>维保单位</label>
          </div>
          <div nz-form-control nz-col>
            <nz-input style="width: 200px;" name="partyName" [(ngModel)]="paperlessBean.maintenancePartyName">
            </nz-input>
          </div>
        </div>

        <div nz-form-item nz-col [nzSpan]="6">
          <div nz-form-label nz-col [nzSm]="12" [nzXs]="6">
            <label>申请状态</label>
          </div>
          <div nz-form-control nz-col  [nzSm]="12" [nzXs]="12">
            <nz-select style="width: 150px;" nzAllowClear [nzPlaceHolder]="'请选择'" [(ngModel)]="paperlessBean.applyStatus"
                       [nzShowSearch]="true" name="partyType">
              <nz-option *ngFor="let option of applyTypes" [nzLabel]="option.label" [nzValue]="option.value">
              </nz-option>
            </nz-select>
          </div>
        </div>
      </div>
      <div nz-row>
        <div nz-form-item nz-col [nzSpan]="8">
          <div nz-form-label nz-col [nzSm]="12" [nzXs]="6">
            <label>使用单位</label>
          </div>
          <div nz-form-control nz-col>
            <nz-input style="width: 200px;" name="partyName" [(ngModel)]="paperlessBean.userPartyName">
            </nz-input>
          </div>
        </div>

        <div nz-form-label nz-col [nzSpan]="3">
          <label>申请时间</label>
        </div>
        <div nz-form-item nz-col [nzSm]="8" [nzXs]="8" [nzSpan]="6">
          <nz-datepicker  name="1" [nzSize]="'middle'" [(ngModel)]="paperlessBean.startDate"  [nzFormat]="'YYYY-MM-DD'" [nzPlaceHolder]="'开始时间'"></nz-datepicker> ~
          <nz-datepicker  name="2" [nzSize]="'middle'" [(ngModel)]="paperlessBean.startDate"  [nzFormat]="'YYYY-MM-DD'" [nzPlaceHolder]="'结束时间'"></nz-datepicker>
        </div>

        <button nz-button style="width: 90px;" [nzSize]="'large'" [nzType]="'primary'" (click)="query()">查询</button>
      </div>
    </form>
  </nz-collapse>
</nz-collapseset>
<div>
  <ul nz-menu [nzMode]="'horizontal'">
    <li *ngIf="partyType=='4' && partyLevel == '2'" nz-menu-item (click)="suspend(titleSuspend, contentSuspend, footerSuspend)">
      <i class="anticon anticon-plus"></i>申请中止</li>
  </ul>

  <nz-table #nzTable [nzDataSource]="dataList" nzSize="middle" [nzBordered]="true" [nzIsPagination]="false" (nzDataChange)="displayDataChange($event)">
    <thead nz-thead>
    <tr>
      <th nz-th [nzCheckbox]="true">
        <label nz-checkbox [(ngModel)]="allChecked" [nzIndeterminate]="indeterminate" (ngModelChange)="checkAll($event)">
        </label>
      </th>
      <th nz-th>
        <span>维保单位</span>
      </th>
      <th nz-th>
        <span>使用单位</span>
      </th>
      <th nz-th>
        <span>申请对象</span>
      </th>
      <th nz-th>
        <span>申请时间</span>
      </th>
      <th nz-th>
        <span>申请状态</span>
      </th>
      <th nz-th>
        <span>电梯详情</span>
      </th>
      <th nz-th>
        <span>下载文件</span>
      </th>
      <th nz-th *ngIf="partyLevel == '2'">
        <span>审批</span>
      </th>
      <th nz-th *ngIf="partyLevel == '1'">
        <span>中止审批</span>
      </th>
    </tr>

    </thead>
    <tbody nz-tbody>
    <tr nz-tbody-tr *ngFor="let data of dataList">
      <td nz-td [nzCheckbox]="true">
        <label nz-checkbox [nzDisabled]="data.disabled" [(ngModel)]="data.checked" (ngModelChange)="refreshStatus($event)">
        </label>
      </td>
      <td nz-td>{{data.maintenancePartyName}}</td>
      <td nz-td>{{data.userPartyName}}</td>
      <td nz-td>{{data.jgPartyName}}</td>
      <td nz-td>{{data.applyDate}}</td>
      <td nz-td>{{data.applyStatus | constantTransfer : applyStatus}}</td>
      <td nz-td>
        <button nz-button  [nzSize]="'small'" [nzType]="'primary'" (click)="detail(data)">查看</button>
      </td>

      <td nz-td>
        <span>
          <nz-popover [nzTitle]="'请选择'" [nzPlacement]="'bottom'" [nzTrigger]="'click'">
              <button nz-button [nzSize]="'small'" [nzType]="'primary'" nz-popover>下载</button>
              <ng-template #nzTemplate>
                  <div style="margin-top:10px">
                      <button nz-button [nzSize]="'small'" (click)="downloadFile(data,1)">承诺书</button>
                  </div>
              </ng-template>
          </nz-popover>
        </span>
      </td>
      <td nz-td *ngIf="partyLevel == '2'">
        <span>
          <button nz-button [nzSize]="'small'" [nzType]="'primary'" (click)="approve1(titleAr,contentAr,footerAr,data)">审批</button>
        </span>
      </td>
      <td nz-td  *ngIf="partyLevel == '1'">
        <span>
           <button nz-button [nzSize]="'small'" [nzType]="'primary'" (click)="approve(titleApprove,contentApprove,footerApprove,data)">审批</button>
        </span>
      </td>
    </tr>
    </tbody>
  </nz-table>

  <nz-pagination [nzPageIndex]="paperlessBean.currentPage" nzShowTotal [nzTotal]="total" nzShowSizeChanger
                 (nzPageSizeChange)="nzPageSizeChange($event)" (nzPageIndexChange)="nzPageIndexChange($event)"
                 (nzPageIndexClickChange)="nzPageIndexClickChange($event)" [nzPageSize]="paperlessBean.pageSize"></nz-pagination>
</div>

<!--添加页面 -->
<ng-template #title>
  <span>{{modelTitle}}</span>
</ng-template>
<ng-template #content>
</ng-template>
<ng-template #footer>
  <div>
  </div>
</ng-template>

<!--区级监管单位对无纸化维保申请进行审批 -->
<nz-modal>
  <ng-template #titleAr>
    <span>{{modelTitle}}</span>
  </ng-template>
  <ng-template #contentAr>
    <form>
        <div nz-form-item nz-row>
          <div nz-form-label nz-col [nzSpan]="9" *ngIf="showFlag">
            <label>审批状态</label>
          </div>
          <div nz-form-label nz-col [nzSpan]="9" *ngIf="!showFlag">
            <label>审批</label>
          </div>
          <div nz-form-control nz-col [nzSpan]="8" nzHasFeedback>
            <nz-radio-group [(ngModel)]="tempPaperlessBean.applyStatus" name="status" *ngIf="showFlag">
              <label nz-radio [nzValue]="'1'" [nzDisabled]="true">
                <span>申请中</span>
              </label>
              <label nz-radio [nzValue]="'2'" [nzDisabled]="true">
                <span>审核通过</span>
              </label>
              <label nz-radio [nzValue]="'3'" [nzDisabled]="true">
                <span>审核拒绝</span>
              </label>
              <label nz-radio [nzValue]="'4'" [nzDisabled]="true">
                <span>中止申请中</span>
              </label>
              <label nz-radio [nzValue]="'5'" [nzDisabled]="true">
                <span>已中止</span>
              </label>
            </nz-radio-group>
            <nz-radio-group [(ngModel)]="tempPaperlessBean.applyStatus" name="status" *ngIf="!showFlag">
              <label nz-radio [nzValue]="'2'" [nzDisabled]="false">
                <span>通过</span>
              </label>
              <label nz-radio [nzValue]="'3'" [nzDisabled]="false">
                <span>拒绝</span>
              </label>
            </nz-radio-group>
          </div>
        </div>
        <div nz-form-item nz-row>
          <div nz-form-label nz-col [nzSpan]="9">
            <label>审批意见</label>
          </div>
          <div nz-form-control nz-col [nzSpan]="8" nzHasFeedback>
            <nz-input [(ngModel)]="tempPaperlessBean.remarks" [nzType]="'textarea'" [nzRows]="'4'" [nzPlaceHolder]="''"
                      [nzDisabled]="showFlag" name="remarks"></nz-input>
          </div>
        </div>
        <div nz-form-item nz-row style="margin-bottom:8px; text-align:center">
          <div nz-col [nzSpan]="3" [nzOffset]="8">
            <button nz-button  [nzType]="'primary'" [nzSize]="'large'" (click)="quit()">返回</button>
          </div>
          <div nz-col [nzSpan]="3" *ngIf="!showFlag">
            <button nz-button  [nzType]="'primary'" [nzSize]="'large'" (click)="applySubmit()">提 交</button>
          </div>
        </div>
    </form>
  </ng-template>
  <ng-template #footerAr>
    <div>
    </div>
  </ng-template>
</nz-modal>

<!--提交中止无纸化维保申请 -->
<nz-modal>
  <ng-template #titleSuspend>
    <span>{{modelTitle}}</span>
  </ng-template>
  <ng-template #contentSuspend>
    <form>
      <div nz-form-item nz-row style = "text-align:center">
        <div nz-form-label nz-col [nzSpan]="6">
          <label>维保单位</label>
        </div>
        <div nz-col [nzSpan]="8">
          <nz-input name="partyName" [disabled]="true" [(ngModel)]="tempPaperlessBean.maintenancePartyName">
          </nz-input>
        </div>
      </div>
      <div nz-form-item nz-row style = "text-align:center">
        <div nz-form-label nz-col [nzSpan]="6">
          <label>中止原因</label>
        </div>
        <div nz-col [nzSpan]="8">
          <nz-input [nzType]="'textarea'" [nzRows]="'5'" [nzCols]="'20'" name="suspendReason"  [(ngModel)]="tempPaperlessBean.suspendReason">
          </nz-input>
        </div>
      </div>
      <div nz-form-item nz-row style="margin-bottom:8px; text-align:center">
        <div nz-col [nzSpan]="3" [nzOffset]="8">
          <button nz-button  [nzType]="'primary'" [nzSize]="'large'" (click)="quit()">取 消</button>
        </div>
        <div nz-col [nzSpan]="3">
          <button nz-button  [nzType]="'primary'" [nzSize]="'large'" (click)="submit()">提 交</button>
        </div>
      </div>
    </form>
  </ng-template>
  <ng-template #footerSuspend>
    <div>
    </div>
  </ng-template>
</nz-modal>



<!--市级监管单位对中止申请进行审批 -->
<nz-modal>
  <ng-template #titleApprove>
    <span>{{modelTitle}}</span>
  </ng-template>
  <ng-template #contentApprove>
    <form>
      <div nz-form-item nz-row style = "text-align:center">
        <div nz-form-label nz-col [nzSpan]="6">
          <label>维保单位</label>
        </div>
        <div nz-col [nzSpan]="8">
          <nz-input name="partyName" [disabled]="true" [(ngModel)]="tempPaperlessBean.maintenancePartyName">
          </nz-input>
        </div>
      </div>
      <div nz-form-item nz-row style = "text-align:center">
        <div nz-form-label nz-col [nzSpan]="6">
          <label>中止原因</label>
        </div>
        <div nz-col [nzSpan]="8">
          <nz-input [nzType]="'textarea'" [disabled]="true" [nzRows]="'5'" [nzCols]="'20'" name="suspendReason"  [(ngModel)]="tempPaperlessBean.suspendReason">
          </nz-input>
        </div>
      </div>
      <form>
        <div nz-form-item nz-row>
          <div nz-form-label nz-col [nzSpan]="9" *ngIf="showFlag">
            <label>审批状态</label>
          </div>
          <div nz-form-label nz-col [nzSpan]="9" *ngIf="!showFlag">
            <label>审批</label>
          </div>
          <div nz-form-control nz-col [nzSpan]="8" nzHasFeedback>
            <nz-radio-group [(ngModel)]="paperlessBean.applyStatus" name="status" *ngIf="showFlag">
              <label nz-radio [nzValue]="'1'" [nzDisabled]="true">
                <span>申请中</span>
              </label>
              <label nz-radio [nzValue]="'2'" [nzDisabled]="true">
                <span>审核通过</span>
              </label>
              <label nz-radio [nzValue]="'3'" [nzDisabled]="true">
                <span>审核拒绝</span>
              </label>
              <label nz-radio [nzValue]="'4'" [nzDisabled]="true">
                <span>中止申请中</span>
              </label>
              <label nz-radio [nzValue]="'5'" [nzDisabled]="true">
                <span>已中止</span>
              </label>
            </nz-radio-group>
            <!--审批意见 1 申请中 2 审核通过 3 审核拒绝 -->
            <nz-radio-group [(ngModel)]="tempPaperlessBean.applyStatus" name="status" *ngIf="!showFlag">
              <label nz-radio [nzValue]="'5'" [nzDisabled]="false">
                <span>通过</span>
              </label>
              <label nz-radio [nzValue]="'2'" [nzDisabled]="false">
                <span>拒绝</span>
              </label>
            </nz-radio-group>
          </div>
        </div>
        <div nz-form-item nz-row style = "text-align:center">
          <div nz-form-label nz-col [nzSpan]="6">
            <label>审批意见</label>
          </div>
          <div  nz-col [nzSpan]="8" >
            <nz-input [(ngModel)]="tempPaperlessBean.suspendRemarks" [nzType]="'textarea'" [nzRows]="'5'" [nzPlaceHolder]="''"
                      [disabled]="showFlag" name="remarks"></nz-input>
          </div>
        </div>
        <div nz-form-item nz-row style="margin-bottom:8px; text-align:center">
          <div nz-col [nzSpan]="3" [nzOffset]="8">
            <button nz-button  [nzType]="'primary'" [nzSize]="'large'" (click)="quit()">取 消</button>
          </div>
          <div nz-col [nzSpan]="3" *ngIf="!showFlag">
            <button nz-button  [nzType]="'primary'" [nzSize]="'large'" (click)="suspendSubmit()">提 交</button>
          </div>
        </div>
      </form>
    </form>
  </ng-template>
  <ng-template #footerApprove>
    <div>
    </div>
  </ng-template>
</nz-modal>
